
    <jsp:directive.page import="org.biojava.services.das.registry.DasRegistrySql" />
<jsp:directive.page import="java.util.Map" />
<jsp:directive.page import="java.util.List" />
<jsp:directive.page import="org.biojava.dasobert.dasregistry.DasSource" />
<jsp:directive.page import="org.springframework.beans.factory.BeanFactory"/>
<jsp:directive.page import="org.springframework.context.support.ClassPathXmlApplicationContext"/>
<%
   
   BeanFactory ctx=(new ClassPathXmlApplicationContext("SpringDAO.xml"));
DasRegistrySql dasRegistrySql=(DasRegistrySql)ctx.getBean("registryBean");
System.out.println("new instance in types");
 String auto_id=request.getParameter("id");

if(auto_id!=null){
	
	if(!auto_id.startsWith("DS_")){
		//this is not a pure DS number but a mirrored id
		//ideally this would be a DS_ number for all sources but for now we'll detect non ds numbers and get the ds number
		DasSource source=dasRegistrySql.getDasSourceByURL(auto_id);
		int autId=dasRegistrySql.getAutoID4DasSource(source);
		auto_id=Integer.toString(autId);
	}
	List <Map<String,String>>types=dasRegistrySql.getTypes(auto_id);
	if(types!=null && types.size()>0){
		
		%><div ><table class="dastable"><tr class="row0types"><td>id</td><td>category</td><td>cvId</td><td>number</td></tr><%
	
		for(Map <String,String>type:types){
	String id=type.get("id");
	String cvId=type.get("cvId");
	String category=type.get("category");
	String number=type.get("number");
	if(id==null){
		id="";
	}
	if(cvId==null){
		cvId="";
	}
	if(category==null){
		category="";
	}
	if(number==null){
		number="";
	}
	%>
	
	<tr class="row1types"><td><%=id%></td><td><%=category%></td><td><%=cvId%></td><td><%=number %></td></tr>
	<%}
	%></table></div><%
}else{
	%>No types returned for this source<%
}
}

%>
